{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "  \n",
    "# SCP-003-1的生存条件以及其质量变化的分析"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "初始操作人:调查员10号\n",
    "最后操作人:调查员12号\n",
    "实验类型:模拟实验\n",
    "测算时间 : 2020/8/20 09:26\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 项目研究内容\n",
    "主要针对历史收集到的SCP-003-1数据，通过电脑进行模拟SCP-003-1的特性，测试其模拟体在不同温度下的变化，因不直接对SCP-003-1进行操作，所以危险程度大大降低。但是依然要小心其质量突变，并做好相应防护措施以避免可能存在的模拟体尝试进行的对话。<br />\n",
    "以下是其在相应温度下的质量变化情况，单位为kg。 <br />\n",
    "警告: 调查员10号因违规操作，已经被移除项目组，请后续操作人员严格遵守规则，切勿直接接触样本。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 以下为根据调查员录音整理而得: 供后续操作人员参考"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "调查员10[已移除]: MD这么冷得天气让我来测什么数据 2020/8/15 12:24"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "调查员10[已移除]: 机器快运作起来吧，一会测试完去和温丽探员暖和暖和，就这在家希尔顿吧，嘿嘿 2020/8/15 12:45"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "实验室提示音: 警告! 请勿直接接触样本! 2020/8/15 13:50"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "实验室提示音: 警告! 样本不稳定! 2020/8/15 14:00"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "调查员10[已移除]: 来吧小宝贝，听说你会跟人对话是吧 2020/8/15 14:10"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "未知声音: #%^#@#%^ 2020/8/15 14:10"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "调查员10[已移除]: 啊啊啊啊啊 啊啊啊啊啊啊啊啊啊 啊啊啊啊啊啊啊 啊啊啊啊啊啊! 2020/8/15 14:10"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 调查员12号接入:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "调查员12: 数据读取录入，设定温度38℃，50℃，75℃，请实验室进行数据读取 2020/8/20 09:24"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "|方案编号|#|#|#|#|#|#|#|#|#|#|#|#|\n",
    "|---|---|---|---|---|---|---|---|---|---|---|---|---|\n",
    "|38℃|14|13|9|15|11|13|14|11|NA|NA|NA|NA|\n",
    "|50℃|10|12|7|11|8|12|9|10|13|9|10|9|\n",
    "|75℃|11|5|9|10|6|8|8|7|NA|NA|NA|NA|"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "实验室提示音: 数据已传递 2020/8/20 09:26"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "调查员12: 对样本进行数据分析，请实验室对分析内容进行记录 2020/8/20 09:27"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "实验室提示音:收到。 2020/8/20 09:27"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "------"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 以下为实验执行记录"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "实验记录: <br />\n",
    "本次实验目的在于测试SCP-003-1在不同温度下的质量增长情况，SCP-003-1本身为生物电路板，通常来讲其质量越大代表其内部发展越复杂，当其质量发生突变时会尝试与现场生命体进行沟通，沟通语言为未知语言，但是听到的人或被致幻以致疯癫，或致死。<br /><br />\n",
    "现根据数据计算其在显著性水平为0.05下检验各个温度的质量变化是否有差异。<br />\n",
    "现在假定:各个温度水平$A_j$(j=1,2,3)下的$X_{1j}$,$X_{2j}$,$X_{3j}$来自具有相同方差$\\sigma^2$，均值分别为$\\mu_j$(j-1,2,3)的正态总体N($\\mu_j$,$\\sigma^2$未知，且设不同水平$A_j$下的样本间相互独立)。$\\mu_j$ 与 $\\sigma^2$未知，且设不同水平$A_j$下的样本间相互独立 <br />\n",
    "这意味着$\\mu_1$=$\\mu_2$=$\\mu_3$ <br /><br />\n",
    "忽略掉50℃下的最后4个数据后，开始计算样本平均值,得到总样本平均值为10.125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10.125\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "test_TTL = []\n",
    "test_I = [14,13,9,15,11,13,14,11]\n",
    "test_II = [10,12,7,11,8,12,9,10]\n",
    "test_III = [11,5,9,10,6,8,8,7]\n",
    "test_TTL.extend(test_I)\n",
    "test_TTL.extend(test_II)\n",
    "test_TTL.extend(test_III)\n",
    "mean_TTL = np.mean(test_TTL)\n",
    "print(mean_TTL)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "I,II,III组的各组的样本均值为"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "mean_I = np.mean(test_I)\n",
    "mean_II = np.mean(test_II)\n",
    "mean_III = np.mean(test_III)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "下面计算组间平均值SSB以及其对应的自由度df_b,以及组内平均值SSW及其对应的自由度df_w"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "78.875"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "SSB = np.sum(np.square(test_I-mean_I)) + np.sum(np.square(test_II-mean_II)) + np.sum(np.square(test_III-mean_III))\n",
    "SSB"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "30.65625"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "SSW = 3 * np.square(mean_I - mean_TTL) + 3 * np.square(mean_II - mean_TTL) + 3 * np.square(mean_III - mean_TTL)\n",
    "SSW"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "计算F统计量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "27.015290519877674"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m = 3\n",
    "n = 8\n",
    "df_b = m - 1\n",
    "df_w = m * (n - 1)\n",
    "F_Sta = (SSB/df_b)/(SSW/df_w)\n",
    "F_Sta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "根据F统计量分布表可得，分子自由度为2，分母自由度为21下的$\\alpha$ = 0.1 对应的统计量大小为2.57，而F_Sta远大于这个结果，所以表明SCP-003-1在温度变化下的质量差异非常显著"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 实验执行记录结束"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "-----"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 调查员12号接入:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "调查员12: 实验结束，请求实验室关闭实验设备，清除SCP-033-1的模拟体，并送回样本本体 2020/8/20 17:24 <br /><br />\n",
    "实验室提示音: 已完成相应操作 2020/8/20 17:24 <br /><br />\n",
    "调查员12: 请求打开防护门，请求离开实验室 2020/8/20 17:24 <br /><br />\n",
    "实验室提示音: 防护门已打开 2020/8/20 17:25 <br /><br />\n",
    "实验室提示音: 调查员12号已离开 2020/8/20 17:26 <br /><br /><br />\n",
    "未知声音: #$$^& 调查员12 2020/8/20 17:46 <br /><br />\n",
    "未知声音: 调查员12 @!*(^ 陪我...玩 2020/8/20 19:00 <br /><br />"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### >>>>>>>>>>>>>>>>>>>>>>>>>>>>有关于样本SCP-003-1的研究@2020/8/20<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
